#ifndef _XEMVITRIYEUTHICHFORM_H_
#define _XEMVITRIYEUTHICHFORM_H_

#include <FBase.h>
#include <FUi.h>
#include <FGraphics.h>
#include <FMedia.h>
#include "../Utility/MyParserXml.h"

class XemViTriYeuThichForm: public Osp::Ui::Controls::Form,
		public Osp::Ui::IActionEventListener,
 	public Osp::Ui::IExpandableItemEventListener,
 	public Osp::Ui::ITouchEventListener {
public:
	XemViTriYeuThichForm(void);
	virtual ~XemViTriYeuThichForm(void);
	bool Initialize();
	result OnInitializing(void);
	result OnTerminating(void);
	void OnActionPerformed(const Osp::Ui::Control&, int);
protected:
	Osp::Ui::Controls::Frame*pFrame;
	Osp::Ui::Controls::Form *pFormParent;
public:
	void SetParentForm(Osp::Ui::Controls::Form*pParent);
	void SetFrame(Osp::Ui::Controls::Frame*pFrame);
	// Generated call-back functions
private:
	Osp::Ui::Controls::ExpandableList *pExpandablelist;
	Osp::Base::Collection::LinkedListT<MyViTriYeuThich*>*list;
	Osp::Ui::Controls::EditArea*pEditAreaChuThich;
	Osp::Ui::Controls::CustomListItemFormat* __pMainItemFormat;
	Osp::Ui::Controls::CustomListItemFormat* __pSubItemFormat;
	static const int ID_LIST_MAINITEM = 101;
	static const int ID_LIST_SUBITEM = 102;
	static const int ID_LIST_TEXT = 103;
	static const int ID_LIST_BITMAP = 104;
	static const int ID_SOFTKEY_SHOWMAP = 105;
	static const int ID_SOFTKEY_BACK = 106;
	bool isDelete;
	static int FormId;

public:
	void SetFormId(int id){
		FormId = id;
	}

	static int GetFormId(){
		return FormId;
	}
public:
	Osp::Graphics::Bitmap* GetBitmapN(const Osp::Base::String& name);

	result AddListMainItem(Osp::Ui::Controls::ExpandableList& expandableList,
			Osp::Base::String itemText, Osp::Graphics::Bitmap* pBitmapNormal,
			Osp::Graphics::Bitmap* pBitmapFocused);

	result AddListSubItem(int indexMain,
			Osp::Ui::Controls::ExpandableList& expandableList, int itemId,
			Osp::Base::String itemText);

	void loadDuLieuChoExpandable(Osp::Ui::Controls::ExpandableList*);
	void loadViTriYeuThichLenExpandable();
	void hienThiChiTietNoiDungGhiChu(int mainIndex);
	void xoaViTriYeuThich(int index);

	virtual void OnItemStateChanged(const Osp::Ui::Control &source, int mainIndex, int subIndex, int itemId, int elementId, Osp::Ui::ItemStatus status);
	virtual void OnItemStateChanged(const Osp::Ui::Control &source, int mainIndex, int subIndex, int itemId, Osp::Ui::ItemStatus status);

	virtual void OnTouchDoublePressed(const Osp::Ui::Control &source, const Osp::Graphics::Point &currentPosition, const Osp::Ui::TouchEventInfo &touchInfo);
	virtual void OnTouchFocusIn(const Osp::Ui::Control &source, const Osp::Graphics::Point &currentPosition, const Osp::Ui::TouchEventInfo &touchInfo);
	virtual void OnTouchFocusOut(const Osp::Ui::Control &source, const Osp::Graphics::Point &currentPosition, const Osp::Ui::TouchEventInfo &touchInfo);
	virtual void OnTouchLongPressed(const Osp::Ui::Control &source, const Osp::Graphics::Point &currentPosition, const Osp::Ui::TouchEventInfo &touchInfo);
	virtual void OnTouchMoved(const Osp::Ui::Control &source, const Osp::Graphics::Point &currentPosition, const Osp::Ui::TouchEventInfo &touchInfo);
	virtual void OnTouchPressed(const Osp::Ui::Control &source, const Osp::Graphics::Point &currentPosition, const Osp::Ui::TouchEventInfo &touchInfo);
	virtual void OnTouchReleased(const Osp::Ui::Control &source, const Osp::Graphics::Point &currentPosition, const Osp::Ui::TouchEventInfo &touchInfo);
};

#endif
